Skip to content

chore: migrate build to tsdown and tests to Vitest#49

Open
sriramveeraghanta wants to merge 9 commits into
mainfrom
chore/tsdown-vitest-migration
Open

chore: migrate build to tsdown and tests to Vitest#49
sriramveeraghanta wants to merge 9 commits into
mainfrom
chore/tsdown-vitest-migration

Conversation

@sriramveeraghanta
Copy link
Copy Markdown
Member

@sriramveeraghanta sriramveeraghanta commented May 30, 2026

Summary

Replaces the build pipeline (tsc + dts-bundle-generator) with tsdown, and the test runner (Jest + ts-jest) with Vitest.

  • Build → tsdown: emits dual ESM (dist/index.mjs) + CJS (dist/index.cjs) bundles plus per-format type declarations (.d.mts / .d.cts), exposed via a proper exports map in package.json (main/module/types retained as legacy fallbacks). Drops dts-bundle-generator and the unused types.bundle.d.ts.
  • Tests → Vitest: vitest.config.ts with globals: true (the 30 test files use bare describe/it/expect — left untouched), fileParallelism: false (mirrors the old maxWorkers: 1 to avoid API rate limits), and v8 coverage. tsconfig.jest.jsontsconfig.vitest.json (now covers all of tests/**). All npm script names are unchanged, so CI needs no script edits.
  • CI: pinned build-test.yaml to Node 22 (tsdown requires ^22.18 || >=24); publish-node-sdk.yml already uses Node 24. The published SDK still supports Node >=20 at runtime (tsdown is build-time only).
  • Docs/cleanup: updated CLAUDE.md; removed the stale AGENTS.MD; gitignored coverage/; excluded coverage/ and docs/ from the formatter; refreshed the test README/JSDoc Jest→Vitest references.
  • Removed deps: jest, ts-jest (was mis-placed under dependencies), @types/jest, dts-bundle-generator. Added dev: tsdown, vitest, @vitest/coverage-v8.
  • Includes the design spec + implementation plan under docs/superpowers/.

Test Plan

  • CI build-test passes on Node 22 (lint, format, build, test:e2e with credentials)
  • pnpm build → clean dist/ with .cjs/.mjs + .d.cts/.d.mts; both require() and import resolve PlaneClient
  • pnpm test:unit → 29 files, 0 failures, globals resolve (suites skip without credentials)
  • pnpm test:coverage → v8 coverage report produced
  • pnpm check:lint (0 errors) and pnpm check:format pass
  • npm pack --dry-run ships only dist/** (both formats + declarations) + README.md

Note: tests/e2e/project.test.ts uses a bare describe (not describeIf), so it requires real API credentials to run — pre-existing behavior, identical under Jest; CI provides them.

Summary by CodeRabbit

  • Chores

    • Updated build output to provide dual ESM and CommonJS formats with bundled type declarations
    • Configured conditional package exports for improved module resolution across different import styles
    • Pinned CI environment to Node.js 22 for consistent builds
    • Reorganized build and test infrastructure commands
  • Documentation

    • Updated developer documentation for new build and test conventions

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 30, 2026

Warning

Review limit reached

@sriramveeraghanta, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 53 minutes and 17 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: baeafe62-cf80-44f3-b80f-f97b1b7116de

📥 Commits

Reviewing files that changed from the base of the PR and between b585bf6 and e8ebef9.

📒 Files selected for processing (4)
  • .env.example
  • CLAUDE.md
  • README.md
  • tests/unit/README.md
📝 Walkthrough

Walkthrough

This pull request implements a complete migration of the @makeplane/plane-node-sdk build and test infrastructure. The legacy tsc + dts-bundle-generator pipeline is replaced with tsdown for dual ESM+CJS output with bundled type declarations, and the test framework moves from Jest to Vitest with sequential execution and v8 coverage. CI is pinned to Node 22 to satisfy tsdown requirements.

Changes

Jest-to-Vitest and tsc-to-tsdown Migration

Layer / File(s) Summary
Migration Specification & Implementation Plan
docs/superpowers/specs/2026-05-30-tsdown-vitest-migration-design.md, docs/superpowers/plans/2026-05-30-tsdown-vitest-migration.md
Comprehensive design specification and step-by-step implementation plan document the full migration strategy, including decision rationale, concrete task breakdown (build, test, CI, docs), verification steps, and scope boundaries.
Build System Migration
tsdown.config.ts, package.json, .oxfmtrc.json, CLAUDE.md
New tsdown.config.ts configures dual ESM+CJS output with bundled type declarations. package.json main/module/types/exports updated to dist/index.cjs, dist/index.mjs, dist/index.d.cts with conditional import/require routing. Build scripts switched from tsc to tsdown; Jest/dts-bundle-generator dependencies removed. Formatter ignore patterns extended for coverage and docs output. CLAUDE.md build guidance updated.
Test Framework & Configuration Migration
vitest.config.ts, tsconfig.vitest.json, package.json, tests/helpers/conditional-tests.ts, tests/unit/README.md, CLAUDE.md
New vitest.config.ts enables global test APIs, single-file sequential execution (fileParallelism: false), 60s timeout, and v8 coverage with text/lcov/html reporters. tsconfig.vitest.json switched from jest to vitest/globals type declarations and expanded include pattern. package.json test scripts updated to vitest commands; test dependencies updated. Test helper JSDoc and README documentation updated to reference Vitest. CLAUDE.md testing guidance revised.
CI & Environment Configuration
.github/workflows/build-test.yaml, .gitignore
Node.js version pinned to 22 in GitHub Actions workflow (required for tsdown compatibility). Coverage directory added to .gitignore.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 From Jest to Vitest we hop,
tsdown builds with styles that don't stop,
ESM and CJS in harmony dance,
dual bundles bundled—a migration romance!
Node 22 the stage for this grand debut,
Old config files bid the SDK adieu. ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely summarizes the main changes: migration of the build system from tsc+dts-bundle-generator to tsdown and test framework from Jest to Vitest.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/tsdown-vitest-migration

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
package.json (1)

12-12: types fallback matches emitted declarations; no dist/index.d.ts exists

tsdown output in dist/ contains only index.d.mts and index.d.cts (plus .map files), not dist/index.d.ts. With that output, the current package.json top-level "types": "./dist/index.d.cts" is consistent, and the exports map already points to ./dist/index.d.mts for import and ./dist/index.d.cts for require.

The tsdown migration design/plan docs’ ./dist/index.d.ts guidance applies only when tsdown emits a single index.d.ts; if you want a format-agnostic legacy fallback for older tooling, you’ll need to emit/provide dist/index.d.ts instead of referencing one format.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@package.json` at line 12, The package.json currently lists "types" but tsdown
only emits index.d.mts and index.d.cts, so either set the top-level "types"
field explicitly to "./dist/index.d.cts" (to match emitted declarations and the
existing exports map referencing ./dist/index.d.mts for import and
./dist/index.d.cts for require), or add a build step to generate a
format-agnostic ./dist/index.d.ts (and then point "types" at it) if you need
legacy tooling fallback; update the "types" field or the build pipeline
accordingly and ensure consistency with the "exports" map and emitted files
(index.d.mts, index.d.cts).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@package.json`:
- Line 12: The package.json currently lists "types" but tsdown only emits
index.d.mts and index.d.cts, so either set the top-level "types" field
explicitly to "./dist/index.d.cts" (to match emitted declarations and the
existing exports map referencing ./dist/index.d.mts for import and
./dist/index.d.cts for require), or add a build step to generate a
format-agnostic ./dist/index.d.ts (and then point "types" at it) if you need
legacy tooling fallback; update the "types" field or the build pipeline
accordingly and ensure consistency with the "exports" map and emitted files
(index.d.mts, index.d.cts).

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e8fb5baf-d094-4ec4-ae2b-63e513f74c21

📥 Commits

Reviewing files that changed from the base of the PR and between 18cbaae and b585bf6.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (14)
  • .github/workflows/build-test.yaml
  • .gitignore
  • .oxfmtrc.json
  • AGENTS.MD
  • CLAUDE.md
  • docs/superpowers/plans/2026-05-30-tsdown-vitest-migration.md
  • docs/superpowers/specs/2026-05-30-tsdown-vitest-migration-design.md
  • jest.config.js
  • package.json
  • tests/helpers/conditional-tests.ts
  • tests/unit/README.md
  • tsconfig.vitest.json
  • tsdown.config.ts
  • vitest.config.ts
💤 Files with no reviewable changes (2)
  • AGENTS.MD
  • jest.config.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant